﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using SaleManagement.Common;

namespace SaleManagement.Models
{

    
    class Branchs_Model
    {

        //private int id;

        //public int Id
        //{
        //    get { return id; }
        //    set { id = value; }
        //}
        //private DateTime created_at;

        //public DateTime Created_at
        //{
        //    get { return created_at; }
        //    set { created_at = value; }
        //}
        //private DateTime updated_at;

        //public DateTime Updated_at
        //{
        //    get { return updated_at; }
        //    set { updated_at = value; }
        //}
        //private String name;

        //public String Name
        //{
        //    get { return name; }
        //    set { name = value; }
        //}
        //private int shop_id;

        //public int Shop_id
        //{
        //    get { return shop_id; }
        //    set { shop_id = value; }
        //}
        //private int warehourse_id;

        //public int Warehourse_id
        //{
        //    get { return warehourse_id; }
        //    set { warehourse_id = value; }
        //}
        //private String address;

        //public String Address
        //{
        //    get { return address; }
        //    set { address = value; }
        //}
        //private String phone;

        //public String Phone
        //{
        //    get { return phone; }
        //    set { phone = value; }
        //}

        public int id { get; set; }
        public DateTime created_at { get; set; }
        public DateTime updated_at { get; set; }
        public String name { get; set; }
        public int warehourse_id { get; set; }
        public int shop_id { get; set; }
        public String address { get; set; }
        public String phone { get; set; }



        public Branchs_Model()
        {

        }
        public List<Branchs_Model>select(int shopid)
        {
            String url = "http://192.168.0.105/sale-server/public/"+shopid+"/branchs";
            List<Branchs_Model> list = Template.getData<List<Branchs_Model>>(url);
            return list;
        }
        public bool insert(Branchs_Model branchsdata,int shopid)
        {
            String url = "http://192.168.0.105/sale-server/public/" + shopid + "/branch/register";
            return Template.Create<Branchs_Model>(branchsdata, url);
            
            
        }
    }
}
